import 'package:example/router/example_routes.dart';
import 'package:example/util/widget_util.dart';
import 'package:flutter/material.dart';
import 'package:riki_router/riki_router.dart';

@RikiRoute(
  name: '/demo/1',
  routeName: '无参数页面',
  pageRouteType: PageRouteType.cupertino,
)
class Demo1Page extends StatelessWidget {
  const Demo1Page() : super();

  @override
  Widget build(BuildContext context) {
    RikiPage? route = RikiRouterDelegate.of(context).find(this);
    return Scaffold(
      appBar: buildAppBar('DEMO 1'),
      body: ListView(
        children: [
          Container(
            alignment: Alignment.center,
            height: 44,
            child: Text(route?.routeName ?? ''),
          ),
          buildListTile('跳转DEMO2', () {
            RikiRouterDelegate.of(context).pushNamed(RikiRoutes.demo2.name, arguments: RikiRoutes.demo2.init3(true));
          }),
        ],
      ),
    );
  }
}
